package com.imooc.joe_springmvc1.prepost;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * 配置类
 * Created by joe on 16-8-10.
 */
@Configuration
@ComponentScan("com.imooc.joe_springmvc1.prepsot")
public class PrePostConfig {

    //第一种方法使用Bean的形式
    //initMethod构造函数之后调用,destroyMethod Bean销毁之前调用
    @Bean(initMethod = "init",destroyMethod = "destroy")
    BeanWayService beanWayService(){
        return new BeanWayService();
    }

    //第二种方式使用JSR250形式的注解
    @Bean
    JSR250WayService jsr250WayService(){
        return new JSR250WayService();
    }
}
